#pragma once

#include <iostream>
#include <sstream>
class Response
{
public:
    Response() {}
    Response(int res, int code = 0) : _res(res), _code(code)
    {
    }

    Response(const string &in)
    {
        stringstream strin(in);
        strin >> _res >> _code;
    }

    int GetResult()
    {
        return _res;
    }

    int GetCode()
    {
        return _code;
    }

private:
    int _res;
    int _code;
};

class Request
{
public:
    Request() {}
    Request(int x, int y, char op) : _x(x), _y(y), _op(op)
    {
    }

    Request(const string &in)
    {
        stringstream strin(in);
        strin >> _x >> _y >> _op;
    }

    Response Result()
    {
        switch (_op)
        {
        case '+':
            return Response(_x + _y);
        case '-':
            return Response(_x - _y);
        case '*':
            return Response(_x * _y);
        case '/':
            if (_y == 0)
                return Response(0, -1);
            else
                return Response(_x / _y);
        case '%':
            if (_y == 0)
                return Response(0, -1);
            else
                return Response(_x % _y);
        default:
            return Response(0, -2);
        }
    }

private:
    int _x;
    int _y;
    char _op;
};
